const Mock = require('mockjs');

let trainLocData ={
    "success": true,
    "message": "操作成功！",
    "code": 200,
    "result": [
        {
            'administration' : '沈阳铁路局',
            'depots' : '通辽机务段',
            'type|1': ['5C00','5B00','5A00'],
            'train' : '18001002',
            'capacity' : '客车',
            'line' : '广深铁路',
            'status|1': [0,1,2,3,4],
            'currentPos': [113.175235, 27.8778]
        },
        {
            'administration' : '长沙铁路局',
            'depots' : '株洲机务段',
            'type|1': ['5C00','5B00','5A00'],
            'train' : '18001003',
            'capacity' : '货车',
            'line' : '武深铁路',
            'status': 1,
            'currentPos|+1': [
                [113.048458, 27.939389],
                [113.050174, 27.928621],
                [113.053093, 27.916184],
                [113.053951, 27.909054],
                [113.054638, 27.90329],
                [113.055668, 27.893732],
                [113.056011, 27.886297],
                [113.056183, 27.87689],
                [113.057384, 27.868089],
                [113.059101, 27.858831]
            ]
        },
        {
            'administration' : '沈阳铁路局',
            'depots' : '通辽机务段',
            'type|1': ['5C00','5B00','5A00'],
            'train' : '18001004',
            'capacity' : '货车',
            'line' : '广深铁路',
            'status|1': [0,1,2,3,4],
            'currentPos|+1': [
                [113.064422, 27.928166],
                [113.071632, 27.923464],
                [113.080215, 27.91679],
                [113.088112, 27.911481],
                [113.09927, 27.904352],
                [113.121585, 27.898132],
                [113.134803, 27.894187],
                [113.146991, 27.888422],
                [113.157463, 27.872034],
                [113.155059, 27.860045]
            ]
        },
        {
            'administration' : '沈阳铁路局',
            'depots' : '通辽机务段',
            'type|1': ['5C00','5B00','5A00'],
            'train' : '18001005',
            'capacity' : '客车',
            'line' : '京广铁路',
            'status|1': [0,1,2,3,4],
            'currentPos|+1': [
                [113.275566, 28.017917],
                [113.28947, 27.998731],
                [113.304062, 27.974719]
            ]
        },
        {
            'administration' : '沈阳铁路局',
            'depots' : '株洲机务段',
            'type|1': ['5C00','5B00','5A00'],
            'train' : '18001009',
            'capacity' : '货车',
            'line' : '广深铁路',
            'status|1': [0,1,2,3,4],
            'currentPos|+1': [
                [113.014895, 27.975477],
                [113.010692, 27.98154],
                [113.000049, 28.001701],
                [112.96606, 27.971535]
            ]
        },
        {
            'administration' : '沈阳铁路局',
            'depots' : '通辽机务段',
            'type|1': ['5C00','5B00','5A00'],
            'train' : '18001006',
            'capacity' : '货车',
            'line' : '广深铁路',
            'status|1': [0,1,2,3,4],
            'currentPos|+1': [
                [113.044637, 27.878255],
                [113.059056, 27.881594],
                [113.072103, 27.885235],
                [113.082402, 27.900711]
            ]
        }
    ],
    "timestamp": 1621818809912
}

let faultLocData ={
    "success": true,
    "message": "操作成功！",
    "code": 200,
    "result": {
        'major' : 1,
        'secondary' : 5 ,
        'minor' : 2 ,
        'fault|10' : [{
            'train|1': ['18001002','18003004','18005006'],
            'level|1': ['严重','中等','轻微'],
            'code|1': ['9007','9008','9009'],
            'name|+1': [
                'TCU与硬线方向信号不一致',
                '3个及以上牵引单元失效',
                '蓄电池烟感报警',
                'IDI2通讯故障',
                '紧急逆变器故障',
                '车门8关门超时'],
            'time|1': ['2020-02-01 18:00','2020-02-13 18:01','2020-03-01 18:02'],
            'source|+1': [
                '列车控制系统故障',
                '列车控制系统故障',
                '蓄电池故障',
                'PIS故障',
                '空调系统故障',
                '车门系统故障']
            }
        ]
    },
    "timestamp": 1621818809912
}

let InfoLocData ={
    "success": true,
    "message": "操作成功！",
    "code": 200,
    "result": {
        'totalTrain': 18,
        'onlineTrain': 15,
        'faultTrain': 3,
        'offlineTrain': 3,
        'mileage':74.8,
        'energy':245
    },
    "timestamp": 1621818809912
}

let selecteGather = {
    "success": true,
    "message": "操作成功！",
    "code": 200,
    "result": [
        {name: 'administration', value: '配属路局', option: ['全部','沈阳铁路局']},
        {name: 'depots', value: '配属机务段', option: ['全部','通辽机务段']},
        {name: 'type', value: '车型', option: ['全部','50CC']},
        {name: 'train', value: '车号', option: ['全部','0170178']},
        {name: 'capacity', value: '客/货类型', option: ['全部','客车','货车']},
        {name: 'line', value: '运行线路', option: ['全部','京沈高铁']},
    ],
    "timestamp": 1621818809912
}

export default {
    'get|/getTrainInfo': trainLocData,
    'get|/getFault': (opt) => {
        return Mock.mock(faultLocData);//使模板生效
    },
    'get|/getInfo': InfoLocData,
    'get|/getSelectList':  selecteGather
}
